//-----------------------------------------------------------------------------
//	File: i2c.c
//	Author: xialing
//		bsp of soft i2c
//-----------------------------------------------------------------------------

#ifndef __I2C_H__
#define	__I2C_H__

#include "stm32f10x.h"

//-----------------------------------------------------------------------------
//	configure_i2c_gpio - configure i2s module gpio
//-----------------------------------------------------------------------------
void configure_i2c_gpio(void);

//-----------------------------------------------------------------------------
//	i2c_start - Generate i2c start flag
//-----------------------------------------------------------------------------
void i2c_start(void);

//-----------------------------------------------------------------------------
//	i2c_stop - Generate i2c stop flag
//-----------------------------------------------------------------------------
void i2c_stop(void);

//-----------------------------------------------------------------------------
//	i2c_ack - return the ack status
//-----------------------------------------------------------------------------
uint8_t i2c_ack(void);

//-----------------------------------------------------------------------------
//	i2c_wait_ack - wait the i2c ack
//-----------------------------------------------------------------------------
void i2c_wait_ack(void);

//-----------------------------------------------------------------------------
//	i2c_write - write data to I2C bus
//		@data: Data or Slave I2C's Address with R/W flag
//-----------------------------------------------------------------------------
void i2c_write(uint8_t data);

//-----------------------------------------------------------------------------
//	i2c_read - read data from I2C bus
//		@pdata: data pointer
//		@len: length of data
//-----------------------------------------------------------------------------
void i2c_read(uint8_t *pdat, uint16_t len);

#endif
